﻿using System;
using System.IO;
using AutoCodeUI;
using AutoCodeWeProto;
using Batch2D;
using CGModule.UserSetup;
using CSUtils;
using TripleJumpRoleCfg;
using U3dComm;
using U3dUtils;
using UnityEngine;
using UnityEngine.SceneManagement;

namespace TripleJump {
    public class TripleJump_Init : MonoBehaviour {
        string gameIndexName = "TripleJump_Init";

        static bool _isInit;

        public static void Init() {
            if (_isInit) {
                return;
            }
            _isInit = true;
            CfgTJumpRole.InitAll();
            Register_WeProto_U3d_TripleJump.RegisterWeProtoType();
            Register_UI_U3d_TripleJump.RegisterUIType();
            TagAnim.GetHash("readyGo");
            TagAnim.Register((int)EAnimType.turn, "turn01");
        }

        public static void EnterGame() {
            MainAssetsManager.LoadScene("Packages/com.aix9000.minigame02/ResourcesAB/TripleJump/Scene/G02_StartGame.unity", LoadSceneMode.Single, (scene => {
                CCanvas.SetURPUICam();
            }));
        }

        void Start() {
            Init();
            Debug.LogFormat("加载开始__________0___{0}____{1}____{2}", Time.realtimeSinceStartup, Time.time, Time.frameCount);

            //C_CrashHandler.GetInstance(); //._Init();
            //SystemTipsUI.prefabPath = "Game/G02/U3d_TripleJump/Resources/G02/UI/UI_SystemHints/UI_SystemHints.prefab";
//            CDataBackup.C_Parameter.d_UiTips_HasHighGradeDataNeedLoadEvent = delegate(Action callback) {
//                SystemTipsUI.GetInstance().o_TipsView.S_ShowMessage(null, "您有原始账号数据需要回复", "程序即将退出，请从新打开游戏", callback);
//            };

            CUserSetup.Init_Art(gameIndexName);
            //G02.TripleJump.Object.C_RegisterWeData.S_RegisterWeData();

            CDelayMain.Delay(0).SetPauseEnd("").onCallback = delegate {
                //UI_LanguageSetting.CParameter.d_SetLanguageEvent = S_LoadingLocalLanguageDataEvent;

                GameManage_TripleJump.instance._Init();
            };
        }
    }
}
